import { quickSort } from "./03_泛型函数";
let chineseArr = ["武汉", "石家庄", "郑州", "太原", "济南", "沈阳", "大连"];

/* let cnStr = "武汉";
let cnStr1 = "郑州";
// 比较两个中文的顺序
console.log(cnStr.localeCompare(cnStr1, "zh-CN")); */

export function sortChinese(arr: Array<string>) {
  return arr.sort((preStr, curStr) => {
    return preStr.localeCompare(curStr, "zh-CN");
  });
}

// 判断是否是中文
export function isChinese(arr: string[]): boolean {
  let pattern = /[\u4e00-\u9fa5]+/g;
  return arr.some((item) => pattern.test(item));
}

export {};
